home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 374 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.3 KB  |  43 lines

  1. Path: sierra.net!usenet
  2. From: "Tyler G. Colwell" <snowbull@sierra.net>
  3. Newsgroups: comp.lang.c++
  4. Subject: Strange (to me) notation - little help?
  5. Date: Wed, 03 Jan 1996 17:51:40 -0800
  6. Organization: Sierra-Net
  7. Message-ID: <30EB32AC.2836@sierra.net>
  8. NNTP-Posting-Host: 204.94.232.59
  9. Mime-Version: 1.0
  10. Content-Type: text/plain; charset=us-ascii
  11. Content-Transfer-Encoding: 7bit
  12. X-Mailer: Mozilla 2.0b3 (WinNT; I)
  13.  
  14. I am reading Jesse Liberty's "Teach Yourself C++ in 21 Days" and have come across some notation that I can't 
  15. find explained anywhere.  Here is a code fragment of a constructor that he uses in listing 9.4:
  16.  
  17. ***********************************************
  18.  class SimpleCat
  19.  {
  20.     public:
  21.        SimpleCat (int age, int weight);
  22.        ~SimpleCat() {}
  23.        int GetAge() { return itsAge; }
  24.        int GetWeight() { return itsWeight; }
  25.     private:
  26.        int itsAge;
  27.        int itsWeight;
  28.  };
  29.  
  30.  SimpleCat::SimpleCat(int age, int weight):
  31.  itsAge(age), itsWeight(weight) {}
  32. ***********************************************
  33.  
  34. Wow, those last two lines are dumbfounding.  What is the colon at the end of that one line for, and what's up 
  35. with using members itsAge and itsWeight as functions in the last line, and howcome none of them are inside the 
  36. braces?
  37.  
  38. Looking forward to some clarification on this one...
  39.  
  40. Thanks,
  41.  
  42. Tyler Colwell
  43.